using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.Persistent.Validation;
namespace Ascent.QiPei.Module.BusinessObjects.Purchase
{
    //现在的软件是在输入了原有单号的情况下 会自动弹出单子对应的价格 如果没有输入对应单号的话 则弹出默认的销售类别价格
    //因为有时候客户不记得单号 也可能没做过这比单 对方要求退货
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("采购管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("采购退货")]
  public partial class PurchasingReturn : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.String _remark;
    private System.DateTime _returnsDate;
    private System.String _pONumber;
    private Ascent.QiPei.Module.BusinessObjects.Base.Supplier _supplier;
    private System.String _pRDCode;
    public PurchasingReturn(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单号")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.String PRDCode
    {
      get
      {
        return _pRDCode;
      }
      set
      {
        SetPropertyValue("PRDCode", ref _pRDCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("供应商")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Supplier Supplier
    {
      get
      {
        return _supplier;
      }
      set
      {
          SetPropertyValue("Supplier", ref _supplier, value);
        //if (_supplier == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Supplier prevSupplier = _supplier;
        //_supplier = value;
        //if (IsLoading)
        //  return;
        //if (prevSupplier != null && prevSupplier.PurchasingReturn == this)
        //  prevSupplier.PurchasingReturn = null;
        //if (_supplier != null)
        //  _supplier.PurchasingReturn = this;
        //OnChanged("Supplier");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("采购单编号")]
    [DevExpress.Persistent.Base.DataSourcePropertyAttribute("Supplier.POCode")]
    public System.String PONumber
    {
      get
      {
        return _pONumber;
      }
      set
      {
        SetPropertyValue("PONumber", ref _pONumber, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remark
    {
      get
      {
        return _remark;
      }
      set
      {
        SetPropertyValue("Remark", ref _remark, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("退货日期")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.DateTime ReturnsDate
    {
      get
      {
        return _returnsDate;
      }
      set
      {
        SetPropertyValue("ReturnsDate", ref _returnsDate, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("PurchasingReturnItems-PurchasingReturn")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品明细")]
    public XPCollection<Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingReturnItems> PurchasingReturnItems
    {
      get
      {
        return GetCollection<Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingReturnItems>("PurchasingReturnItems");
      }
    }
  }
}
